package com.twu.biblioteca.user;

import java.util.HashMap;
import java.util.LinkedHashMap;

public class UserInfo {
    private String name;
    private String email;
    private String address;
    private Integer phone;
    private boolean loggedIn;
    private String password;

    public UserInfo(String name, String email, String address, Integer phone, String password) {
        this.name = name;
        this.email = email;
        this.address = address;
        this.phone = phone;
        this.password = password;
    }



    private static HashMap< String,UserInfo> map = new LinkedHashMap<String,UserInfo>();

    static {
        map.put(new LibraryNumber(111,1111).toString() ,new UserInfo("Mike", "test@qq.com", "USA",1101,"111,1111"));
        map.put(new LibraryNumber(111,1112).toString() ,new UserInfo("Harry", "test1@qq.com", "ENGLAND",1102,"111,1112"));
        map.put(new LibraryNumber(111,1113).toString() ,new UserInfo("Lily", "test2@qq.com", "USA",1103,"111,1113"));
        map.put(new LibraryNumber(111,1114).toString() ,new UserInfo("Susan", "test3@qq.com", "USA",1104,"111,1114"));
    }


    public static UserInfo from(String libraryNumber) {
        return map.get(libraryNumber);
    }

    public String getName() {
        return name;
    }

    public String getEmail() {
        return email;
    }

    public String getAddress() {
        return address;
    }

    public Integer getPhone() {
        return phone;
    }

    public boolean isLoggedIn() {
        return loggedIn;
    }

    public void setLoggedIn(boolean loggedIn) {
        this.loggedIn = loggedIn;
    }

    public static HashMap<String, UserInfo> getUsers() {
        return map;
    }

    public String getPassword() {
        return password;
    }
}
